#pragma once

#include <rocksdb/db.h>
#include <rocksdb/env.h>

#include <atomic>
#include <memory>
#include <mutex>

#include "third_party/slash/checkpoint.h"

namespace libraft {
class Raft;
class Snapshot {
 public:
  Snapshot();

  ~Snapshot();

  rocksdb::Status Open();
  rocksdb::Status CreateCheckpoint(const std::shared_ptr<rocksdb::DB>& log_db,
                                   const std::string& snapshot_name,
                                   uint64_t log_size_for_flush = 0);

 private:
  Snapshot(const Snapshot&);
  void operator=(const Snapshot&);

  const rocksdb::Options options_;
  std::map<std::string, std::shared_ptr<rocksdb::DB>> all_snapshot_dbs_;
  std::shared_ptr<rocksdb::Checkpoint> check_point_;
};

}  // namespace libraft